/**
* \file		@(ProjName)_main.cpp
* \date		(@(CurrentTime))/(@(CurrentTime))
*-----------------------------------------------------------------------------
* \brief		@(ProjName) main file.
*				dll initalization.
* \version		1.0.0.1
* \author		Nick Shallery	(nicknide@gmail.com)
* \copyright	YOU HAVE ALL LEFT WITH THIS CODE WHILE YOU KEEP COMMENT IN EVERY COPY.
*-----------------------------------------------------------------------------
**/

#include	<lolix/imp/lolix_plugin_auto_release_lib.inl>
#include	<lolix/imp/lolix_plugin_enter.inl>

extern "C" lolix::LOLIX_RETNV	LOLIX_CALL lxpLoading(lolix::lolix_inst* lx_inst, lolix::lolix_regist* lx_reg)
{
	lolix::LOLIX_RETNV rtv;
	lolix::dynamic_allocator* alc;
	if ( LOLIX_CHECK_ERROR(rtv = lx_reg->query_itf(&alc)) )
		return rtv;
	atexit_release(*alc);
	lolix::ref_factory* ref_fac;
	if ( LOLIX_CHECK_ERROR(rtv = lx_reg->query_itf(&ref_fac)) )
		return rtv;
	atexit_release(*ref_fac);
	//TODO: add more init code here
	return rtv;
}


extern "C" lolix::LOLIX_RETNV	LOLIX_CALL lxpFreeing(lolix::lolix_inst* lx_inst)
{
	return lolix::imp::plugin_auto_release_lib_query(lx_inst);
}

#if			0
static lolix::LOLIX_RETNV process_enter(void)
{
	return lolix::LOLIX_RETNV_OK;
}

static void process_leave(void)
{
}

static void thread_enter(void)
{
}

static void thread_leave(void)
{
}

#else	//	0
#define	process_enter	0
#define	process_leave	0
#define	thread_enter	0
#define	thread_leave	0
#endif	//	0

#define		@(ProjName)_LIB_ID	@(LOLIX_DEF__ZERO_ITF_ID)
LOLIX_DEF__PLUGIN_ENTER(@(ProjName)_LIB_ID, "@(ProjName)"
	, process_enter, process_leave, thread_enter, thread_leave);
